<php>
$brand_id	= $_REQUEST['brandid'];	//商户id		对应页面右侧主搜索区
if(empty($brand_id))$brand_id	= $_REQUEST['bid'];	
$brandService = service('Brand');
$brandBasInfo = $brandService->getById($brand_id);
$brandExtInfo = $brandService->getExtInfoByBid($brand_id);
//dump($brandBasInfo);
</php>

<style>
<!--
#map-box{
	border: 0px solid #EAEAEA;
	height:  400px;
	width: 510px;
}
-->
</style>

<script type="text/javascript">
  	function goPageBSub(pno){
		$.kajax({      
			url:"{:U('Product://Brand/ajxSearchBSub')}",      
			type:'post', //数据发送方式  
			data:{brandid:$('#bsub_search_data').find('#brandid').val()
					,area_id:$('#bsub_search_data').find('#area_id').val()
					,city_id:$('#bsub_search_data').find('#city_id').val()
					,pno:pno} ,    
			async: false ,//同步方式     
			success: function(html){ 
				$('#bsub_list_area').html(html);
			}
		});
	}

</script>



<div class="wrapper">

	<div class="left">
		<div class="intro" style="border-bottom: 0px solid #EAEAEA;margin: 0px;padding:0px;background-color: #FFFFFF;">
        	<h1 style=" font-size: 12px;line-height: 25px;">注意事项:</h1>
        	<p>若您收到的礼物为配送的商品，请拨打商家电话（{$brandBasInfo['phone']},{$brandBasInfo['mobile']}）告知配送地址。</p>
        	{$brandExtInfo['explain']}
        </div>
        <div class="clear"></div>
        <div id="map-box"></div>
        <div class="clear"></div>
    </div>
	
	<php>$bsub_brandid = $brand_id;
				$_REQUEST['goPageFun']="goPageBSub";//设定分页调用函数
				if(empty($bsub_brandid))$bsub_brandid	= $_REQUEST['brandid'];	//商户id	
				$bsub_area_id	= $_REQUEST['area_id'];	//区域id	
				$bsub_city_id	= $_REQUEST['city_id'];	//城市id
				$bsub_bsubpage 	= service('Brand')->search4UserBSub($bsub_brandid,$bsub_area_id,$bsub_city_id);
				if(empty($bsub_bsubpage)||empty($bsub_bsubpage['data'])){
	</php>
					
	<php>}else{
		$index=0;</php>
	
				
				
					<script type="text/javascript">
					//<!CDATA[
					$(function(){
						initMap("map-box","39.925","116.385",12);
						cleanAll();
						var store_infos = eval('( ' + $('#store_json_data').html() + ' )');
						store_markers = drawStoreMarkers(store_infos,marker_icon);
						map.centerAndZoom( store_markers ,12 );
						initStoreList();
						initstyle();
					});
					/**
					 * 返回店铺列表后，页面执行的初始化方法。
					 */
					function initStoreList(){
						$("#bsub_list_area").find('#addr_drief').each(function(){
							$(this).hover(
									function(){
										//当鼠标放上去的时候,程序处理
										var _rel = $(this).attr('rel');
										var _ttmp_marker = getStoreMarker(_rel);
										if(_ttmp_marker!=null){
											_ttmp_marker.marker.setIcon(marker_icon_hover);
										}
									},
				
									function(){
									   	//当鼠标离开的时候,程序处理
										var _rel = $(this).attr('rel');
										var _ttmp_marker = getStoreMarker(_rel);
										if(_ttmp_marker!=null){
											_ttmp_marker.marker.setIcon(marker_icon);
										}
									}
							);
							$(this).unbind('click');
							$(this).click(function(){
								var _rel = $(this).attr('rel');
								var _ttmp_marker = getStoreMarker(_rel);
								if(_ttmp_marker!=null){
									var _infoWindow = getStoreInfoWindow(new BMap.Size(0, _ttmp_marker.marker.getIcon().size.height*(-1) ),_ttmp_marker.storeinfo);
									_ttmp_marker.marker.openInfoWindow(_infoWindow);
								}else{
									ui.error('地图坐标未设定！');
								}
							});
						});
					}
					function initstyle(){
					    $("#bsub_list_area").find('#addr_drief').each(function(){
					    	$(this).hover(
					    		      function () {
					    			  		$(this).addClass("addr-box_on");
					    			  },
					    			  function () {
					    			        $(this).removeClass("addr-box_on");
					    			  }
					    	);
					    });
					}
					//]]>
					</script>
				  	<div id="store_json_data" class="hidden">
						<php>
						if(count($bsub_bsubpage['data'])>0){
							echo json_encode( format2MapData($bsub_bsubpage['data']) );
						}
						</php>
					</div>
	<php>}</php>	
</div>
